Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filter function restore on session load #1970

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

doremiyeon
Copy link
Contributor

loading a session or switching to a different context with a different filter mode setting (regex vs string) will not update the filter function and can lead to crashes

  • on session load, restore correct filter function
  • also switch filterfn on ctx changes

this should fix more crashes related to switching between contexts with
different types of filters active. particularly when switching from a regex
filtered context to a string filtered one.
@@ -4542,6 +4543,7 @@ static bool load_session(const char *sname, char **path, char **lastdir, char **
*path = g_ctx[cfg.curctx].c_path;
*lastdir = g_ctx[cfg.curctx].c_last;
*lastname = g_ctx[cfg.curctx].c_name;
setcfg(cfg);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How are the other 2 working without calling setcfg()? Is savecurtx() being called in some way?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the other 2 contexts? savecurtx() should be called on any context switch, I think. I don't really like calling setcfg here, because it doesn't change the cfg assignment and set_sort_flags() already sets the other two function pointers. the important point is that the filter function pointer is set for the current context after the session is loaded. i think one of the individual commits has some more information on that

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, entrycmpfn and namecmpfn.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I am not clear, I wanted to understand how entrycmpfn and namecmpfn are being set without setcfg not being called in the current code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants